home *** CD-ROM | disk | FTP | other *** search
- <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
- <html>
-
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Description" content="Antanna ocx Control Documentation">
- <meta name="KeyWords" content="Antanna, Control, Documentation, Visual Basic, OCX">
- <meta name="GENERATOR" content="Microsoft FrontPage 3.0">
- <title>Antenna Control Tutorial</title>
- </head>
-
- <body bgcolor="#FFFFFF" text="#000000" link="#0000EE" vlink="#551A8B" alink="#FF0000">
-
- <p>[<a href="index.htm">Antenna Documentation</a>]</p>
-
- <hr>
-
- <h2>Antenna Control Tutorial</h2>
-
- <blockquote>
- <p>This tutorial explains how to use Antenna control properly in Visual Basic 4.0 or
- above.<ul>
- <li><a href="#T0">Antenna Basics</a></li>
- <li><a href="#T1">How to Set (or Change) Target hWnd</a></li>
- <li><a href="#T2">How to Trap Messages</a></li>
- <li><a href="#T3">How to Respond to Messages</a></li>
- <li><a href="#T4">How to Destroy Antenna Control</a></li>
- </ul>
- <p> </p>
- <h3><a name="T0">Antenna</a> Basics</h3>
- <blockquote>
- <p>Antenna control is an OCX that allows Visual Basic applications to trap and process
- Windows messages that are not handled directly by Visual Basic.</p>
- <p>When you specify the Target hWnd, Antenna starts to monitor all messages that were
- originally sent to the Target hWnd. You can then add messages you want to process.</p>
- <p>Antenna control was tested under Visual Basic 4.0 using Windows 95.</p>
- <p> </p>
- </blockquote>
- <h3><a name="T1">How</a> to Set (or Change) Target hWnd</h3>
- <blockquote>
- <p>When you create Antenna, the first thing you have to do is to set the Target hWnd, so
- that Antenna will start to trap messages of the Target hWnd.</p>
- <p>To set the Target hWnd, use the method <a href="reference.htm#SetTargetWnd">SetTargetWnd()</a>,
- like in the following example:</p>
- <pre>...
- Antenna1.SetTargetWnd(Text1.hWnd)
- ...</pre>
- <p>One Antenna can only have one Target hWnd. To trap multiple windows' messages, you need
- to create multiple Antenna.</p>
- <p>When you change the Target hWnd, all messages it used to trap will be cleared. You have
- to use AddPreMsg() and AddPostMsg() methods to add messages.</p>
- <p> </p>
- </blockquote>
- <h3><a name="T2">How</a> to Trap Messages</h3>
- <blockquote>
- <p>Once you create Antenna, you have to notify Antenna which messages to trap. You can
- trap messages either before or after the original function of the Target hWnd is
- processed.</p>
- <p>If you want to process messages before the original function, use the method <a
- href="reference.htm#AddPreMsg">AddPreMsg()</a> as in the following example:</p>
- <pre>Const WM_DROPFILES &23
- ...
- Antenna1.AddPreMsg(WM_DROPFILES, True)
- ...</pre>
- <p>The second parameter indicates whether the message should be "eaten".</p>
- <p>To process messages after the original function, use the method <a
- href="reference.htm#AddPostMsg">AddPostMsg()</a> as in the following example:</p>
- <pre>Const WM_DROPFILES &23
- ...
- Antenna1.AddPostMsg(WM_DROPFILES)
- ...</pre>
- <p>You can add 30 messages at maximum (15 in AddPreMsg() and 15 in AddPostMsg()). When you
- exceed 15, the subsequent messages will not be added.</p>
- <p>You cannot remove messages you added unless you call <a
- href="reference.htm#SetTargetWnd">SetTragetWnd()</a> to change the Target hWnd.</p>
- <p> </p>
- </blockquote>
- <h3><a name="T3">How</a> to Respond to Messages</h3>
- <blockquote>
- <p>When Antenna receives a message, it calls OnTrap() function of itself. You can respond
- to the message inside <a href="reference.htm#OnTrap">OnTrap()</a> as in the following
- example:</p>
- <pre>Private Sub OnTrap(hWnd As Long, nMsg As Long, wParam As Long, lParam As Long)
- MsgBox "Message was trapped"
- End Sub</pre>
- <p align="left">This function is called either before or after the Target hWnd handled the
- message, depending on how you added the message. If you used <a
- href="reference.htm#AddPreMsg">AddPreMsg()</a>, it is called before the original function.
- If you used <a href="reference.htm#AddPostMsg">AddPostMsg()</a>, it is called after the
- original function.</p>
- <p> </p>
- </blockquote>
- <h3><a name="T4">How</a> to Destroy Antenna Control</h3>
- <blockquote>
- <p>When you are using Antenna in Visual Basic's "Run" mode, you will need to
- destroy Antenna explicitly. This can be done by using <a href="reference.htm#DestroyAll">DestroyAll()</a>
- method. The following example illustrates the point:</p>
- <pre>Private Sub Unload()
- Antenna1.DestroyAll()
- End Sub</pre>
- <p>You will need to remember the following points:<ol>
- <li>Call DestroyAll() once and only once whether or not you created multiple Antenna.
- DestroyAll() can be called from any Antenna.</li>
- <li>The call to call to DestroyAll() should be made in Unload() method of the main window.</li>
- <li>The call to DestroyAll() is <b>not</b> necessary when you create EXE. Unexpected result
- might happen if you call the function from EXE.</li>
- </ol>
- <p> </p>
- </blockquote>
- </blockquote>
-
- <hr>
-
- <p align="center">If you have any comments or questions, please contact <a
- href="mailto:integer@pair.com">integer@pair.com</a>.</p>
-
- <p align="center">Copyright ⌐ 1998 <a href="http://www.integer.pair.com/">Integer</a> </p>
- </body>
- </html>
-
-